package com.example.shuiyin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("subscriptions")
public class Subscription {
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("user_id")
    private Long userId;
    
    @TableField("plan_id")
    private Long planId;
    
    @TableField("order_id")
    private String orderId;            // 订单ID
    
    private BigDecimal amount;         // 支付金额
    private String status;             // 订阅状态(active, canceled, expired)
    
    @TableField("start_date")
    private LocalDateTime startDate;   // 开始日期
    
    @TableField("end_date")
    private LocalDateTime endDate;     // 结束日期
    
    @TableField("billing_cycle")
    private String billingCycle;       // 计费周期(月, 年)
    
    @TableField("quota_total")
    private Integer quotaTotal;        // 总配额
    
    @TableField("quota_used")
    private Integer quotaUsed;         // 已使用配额
    
    @TableField("auto_renew")
    private Boolean autoRenew;         // 是否自动续费
    
    @TableField("cancel_reason")
    private String cancelReason;       // 取消原因
    
    @TableField("canceled_at")
    private LocalDateTime canceledAt;  // 取消时间
    
    @TableField("created_at")
    private LocalDateTime createdAt;
    
    @TableField("updated_at")
    private LocalDateTime updatedAt;
} 